/// **************************************************************************************************
/// "Copyright (c) 2007 Sai Panyam, Inc.  All rights reserved."
/// **************************************************************************************************
/// Component Name   :	ModifierCollection, Member of System72.NTextile 
/// Description      :	ModifierCollection description
/// Author           :	Sai Panyam
/// Creation Date    :	November 09 2007
/// Modified Date    :              
/// Modified By      :
/// **************************************************************************************************
using System.Collections.Generic;

namespace System72.NTextile
{
    /// <summary>
    /// 
    /// </summary>
    public class ModifierCollection:List<IModifier>
    {
        #region Private Variables

        private IModifier m_modifierToMatch;

        #endregion

        #region Public Methods
        /// <summary>
        /// 
        /// </summary>
        /// <param name="modifier"></param>
        /// <returns></returns>
        public bool ContainsModifier(IModifier modifier)
        {
            if (modifier!=null)
            {
                m_modifierToMatch = modifier;
                return Exists(modifierSearchPredicate);
            }
            else
            {
                return false;
            }
        }

        #endregion
        
        #region Private Method
        /// <summary>
        /// 
        /// </summary>
        /// <param name="matchModifier"></param>
        /// <returns></returns>
        private bool modifierSearchPredicate(IModifier matchModifier)
        {
            if(matchModifier!=null )
            {
                if(matchModifier.Type==m_modifierToMatch.Type)
                {
                    return true;
                }
            }
            return false;
        }

        #endregion

    }
}
